import 'dart:io';

import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quick/Controller/im_controller.dart';
import 'package:flutter_quick/common/utils/TIM.dart';
import 'package:flutter_quick/routes/routes.dart';
import 'package:get/route_manager.dart';
import 'package:get/get.dart';

void main() {
  runApp(App());
  if (Platform.isAndroid) {
    SystemUiOverlayStyle systemUiOverlayStyle =
        SystemUiOverlayStyle(statusBarColor: Colors.transparent);
    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  }
  init();
}

// 会话列表
init() async {
  TIM im = TIM();
  Get.put(IMController(im));
  await im.init();
  await im.login();
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Flutter quick',
      debugShowCheckedModeBanner: false,
      initialRoute: '/',
      routes: Routes.router(context),
    );
  }
}
